package com.huahai.security.core.validate.code;

import com.huahai.security.core.supports.ResultResponse;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: Jun
 * @Date: 2020/7/17
 * 校验码处理器，封装不同校验码的处理逻辑
 */
public interface ValidateCodeProcessor {

    /**
     * 验证码放入redis中的前缀
     */
    String REDIS_KEY_PREFIX = "REDIS_KEY_FOR_CODE_";

    /**
     * 创建验证码
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    ResultResponse create(HttpServletRequest request, HttpServletResponse response) throws Exception;

    /**
     * 校验验证码
     *
     * @param request
     * @throws Exception
     */
    void validate(HttpServletRequest request);
}
